#! /bin/sh
#### Run GBmod with CWP PostScript Graphics

if test "$PSPREVIEWER" = ""
then
echo "Environment variable PSPREVIEWER not set" ; exit 1
fi

# model number
model=3

# data directory
datadir=../datadir/

modelfile=${datadir}model${model}.data
modelpsfile=${datadir}model${model}.eps
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data
raypsfile=${datadir}ray.eps

nangle=50 nxz=301 fangle=30 langle=45

####   create  modelfile and modelpsfile
# ../Models/PSmodel${model}

#### Create Figure 4 in the GBmod-paper

triray <$modelfile >$rayendsfile \
        rayfile=$rayfile fangle=$fangle langle=$langle \
        nangle=$nangle xs=0.1 zs=0.1 \
        nxz=$nxz refseq=4,1

####   plot the rays with CWP graphics
psgraph <$rayfile >$raypsfile \
        nplot=`cat outpar` n=$nxz hbox=3.0 wbox=6.0  \
        x1beg=0 x1end=1 x2beg=0 x2end=2 \
        label1="Depth (km)" label2="Distance (km)" \
        style=seismic linegray=0

#####  display the rays and the model
$CWPROOT/bin/psmerge in=$modelpsfile in=$raypsfile | $PSPREVIEWER &

exit 0
